import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useUserStore = defineStore(
  'user',
  () => {
    const user = ref()

    const setUser = (val: unknown) => {
      user.value = val
    }

    const clearUser = () => {
      user.value = undefined
    }

    return { user, setUser, clearUser }
  },
  { persist: true },
)
